package com.spddr.pmos.jpa;

import javax.persistence.Column;
import javax.persistence.Embeddable;

@Embeddable
public class ObjectMetricId implements java.io.Serializable {
	private static final long serialVersionUID = 1L;

	private int objectType;
	private String metric;

	public ObjectMetricId() {
	}

	public ObjectMetricId(int objectType, String metric) {
		super();
		this.objectType = objectType;
		this.metric = metric;
	}

	@Column(name = "object_type")
	public int getObjectType() {
		return objectType;
	}

	public void setObjectType(int objectType) {
		this.objectType = objectType;
	}

	@Column(name = "metric")
	public String getMetric() {
		return metric;
	}

	public void setMetric(String metric) {
		this.metric = metric;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((metric == null) ? 0 : metric.hashCode());
		result = prime * result + objectType;
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		ObjectMetricId other = (ObjectMetricId) obj;
		if (metric == null) {
			if (other.metric != null)
				return false;
		} else if (!metric.equals(other.metric))
			return false;
		if (objectType != other.objectType)
			return false;
		return true;
	}
}
